import axios from "axios";

let configBaseURL = {
    baseURL: 'http://localhost:8081',
    timeout: 5000,

};

const request = axios.create(configBaseURL);

request.interceptors.request.use(
    function(config) {
        // 放置sa-token
        let localStorageSysUserToken = localStorage.getItem("creamDataToken")
        console.log(localStorageSysUserToken)
        if (localStorageSysUserToken && localStorageSysUserToken != "") {
            config.headers['Authorization'] = localStorageSysUserToken
        }
        return config;
    },
    function(error) {
        // Do something with request error
        return Promise.reject(error);
    }
)

request.interceptors.response.use(
  function(response) {
    return response;
  },
  function(error) {
    return Promise.reject(error);
  }
);

export default request